home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / lu62 / novell / pattach.c < prev    next >
C/C++ Source or Header  |  1996-07-10  |  2KB  |  76 lines

  1. /*
  2.  * CopyRight 1995. Nicholas Poljakov all rights reserved.
  3.  */
  4. #include <dos.h>
  5. #include <stdio.h>
  6. #include <memory.h>
  7. #include <nau.h>
  8. extern struct nau naua[100];
  9.  
  10. union REGS inregs, outregs;
  11. struct SREGS segregs;
  12.  
  13. struct crec { /* for IPX interface this structure is the same as
  14.                * for ASYNC driver, but fields after "asc_rcv_exit"
  15.                * my have another sense.
  16.                */
  17.                 void far *asc_rcv_exit;
  18.                 short socket;      /* my socket */
  19.                 char LocalName[8]; /* Name of local LU */
  20.             } rec;
  21.  
  22. extern speed;
  23. extern width;
  24. extern parity;
  25. extern n_port;
  26. extern stop_num;
  27. extern void DrEntry(void);
  28.  
  29. pattach(int n, char _far *pdata, int len)
  30. {
  31.         int i;
  32.         char _far *p;
  33.  
  34.         if ( n == 0) {
  35.            /*   Open   */
  36.             rec.asc_rcv_exit = DrEntry; /* Entry point for device
  37.                                          * driver.
  38.                                          */
  39.         rec.socket = 0x4444;
  40.             memcpy(rec.LocalName, naua[0].name, 8);
  41.             p = &rec;
  42.             inregs.x.dx = FP_OFF( p );
  43.             segregs.ds = FP_SEG( p );
  44.             inregs.x.ax = 0;
  45.         }
  46.         else
  47.             if ( n == 1) {
  48.                /*   Send   */
  49.                 p = pdata - 12;  /* points to start of segment */
  50.                 i = len + 28;
  51.                 inregs.x.dx = FP_OFF( p );
  52.                 segregs.ds = FP_SEG( p );
  53.                 inregs.x.cx = i;
  54.         inregs.h.ah = 1;
  55.         inregs.h.al = 0;
  56.  
  57.             }
  58.             else
  59.                 if ( n == 2) {
  60.                     /*   close   */
  61.              inregs.h.ah = 2;
  62.              inregs.h.al = 0;
  63.         }
  64.  
  65.                 else
  66.              if ( n == 3) {/* Detach_LU */
  67.               inregs.h.ah = 3;
  68.               inregs.h.al = 0;
  69.                      }
  70.                      else
  71.                           return -1;
  72.  
  73.         int86x( 0x6f, &inregs, &outregs, &segregs);
  74.         return 0;
  75. }
  76.